home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / TextHarvest / TextHarvest-Install.exe / {app} / ScriptSample01.txt < prev    next >
Text File  |  2004-12-01  |  3KB  |  55 lines

  1. ;---------------------------------------------------------------------------
  2. ; Sample Script for Pinnacle Software's TextHarvest Product
  3. ;---------------------------------------------------------------------------
  4. ;
  5. ;   This script was designed for the ThingsToDo.txt sample input file,
  6. ;   which is included with Pinnacle Software's script-enabled product
  7. ;   TextHarvest (free download at www.parse-o-matic.com).
  8. ;
  9. ;   It converts the output to CSV (Comma Separated Value) format.
  10. ;   It also makes some other changes to the outgoing data.
  11. ;
  12. ;   For example, if TextHarvest retains the following line:
  13. ;   CAT      Buy a new cat food bowl
  14. ;   Then it will be modified to look like this:
  15. ;   "Cat","Buy a new cat food bowl"
  16. ;
  17. ;---------------------------------------------------------------------------
  18. ; Check TextHarvest settings
  19. ;---------------------------------------------------------------------------
  20. Begin FirstRun = ''                        ; Variables start as nulls
  21.   FirstRun = 'N'                           ; We won't run this block again
  22.   InputFileWanted = 'ThingsToDo.txt'       ; We'll use this later
  23.   X = Len $OptionX $OptionY $OptionZ       ; Measure /Keep /Delete /Controls
  24.   Begin X <> 0                             ; Start of conditional block
  25.     M1 = 'Please clear the /Keep /Delete and' $0A$0D  ; End with CRLF
  26.     M2 = '/Control input boxes and try this'  $0A$0D  ; End with CRLF
  27.     M3 = 'this script again.'                         ; Last line
  28.     Stop M1 M2 M3                          ; Stop with error message
  29.   End                                      ; End of conditional block
  30.   Begin $ActualIFN ~ InputFileWanted       ; Check input file
  31.     M1 = 'Please try this script with the' $0A$0D
  32.     M2 = 'input file' InputFileWanted
  33.     Stop M1 M2                             ; Stop with error message
  34.   End                                      ; End of conditional block
  35. End                                        ; End of conditional block
  36.  
  37. ;---------------------------------------------------------------------------
  38. ; Get the category, remove extra spaces, and change case
  39. ;---------------------------------------------------------------------------
  40. Category = $OutData[1 9]                    ; Get columns 1 to 9
  41. TrimChar Category                           ; Remove spaces on either side
  42. Category = ChangeCase Category 'Hardcaps'   ; Capitalize The Text
  43. If Category = 'Car' Category = 'Auto'       ; Apply a change to Category
  44.  
  45. ;---------------------------------------------------------------------------
  46. ; Get the description. For demonstration purposes, we use the Cols function
  47. ; here, but $OutData[10 999] would also work.
  48. ;---------------------------------------------------------------------------
  49. Description = Cols $OutData 10 999          ; Get columns 10 to end-of-line
  50.  
  51. ;---------------------------------------------------------------------------
  52. ; Send modified information to the output file specified by TextHarvest
  53. ;---------------------------------------------------------------------------
  54. Output '"' Category '",'             ; Output Category with quotes and comma
  55. OutEnd '"' Description '"'           ; Output Description